#include "tools/log.h"
#include "core/task.h"
#include "applib/lib_syscall.h"
#include "dev/tty.h"
int first_task_main(void)
{
    for(int i=0;i<TTY_TABLE_SIZE;i++)
    {
        int pid = fork();
        if(pid<0)
        {
            print_msg("create child task failed",0);
            break;
        }
        // 子进程ret = eax = 0 走这个
        else if(pid == 0)
        {
            char tty_num[] = "/dev/tty?";
            tty_num[sizeof(tty_num) - 2] = i + '0';
            char *arg[] = {tty_num,(char *)0};
            execve("shell.elf", arg, (char **)0);
            while (1)
            {
                msleep(1000);
            }
        }
    }
    

    for(;;)
    {
        int status;
        wait(&status);
    }
    return 0;
}